Skip to content

Add Ctrl+click support for file:line:column references in terminal - #2841

Open
RoiSoleil wants to merge 6 commits into
eclipse-platform:masterfrom
RoiSoleil:add-file-line-column-support
Open

Add Ctrl+click support for file:line:column references in terminal#2841
RoiSoleil wants to merge 6 commits into
eclipse-platform:masterfrom
RoiSoleil:add-file-line-column-support

Conversation

@RoiSoleil

Copy link
Copy Markdown
Contributor

Description

Adds support for Ctrl+click on file references with line and column numbers (e.g., path:42 or path:42:7) in the terminal, commonly produced by git grep -n.

Changes

  • FileReference — immutable record for parsed file references (internal, no public API)
  • FileReferenceParser — parses hover text into path + optional line/column using precise regex (positive integers only, Windows C:\ handled correctly)
  • OpenFileMouseHandler — uses FileReferenceParser instead of inline :\ splitting and lenient regex (\\d*)(:(\\d*))?.*
  • 25 unit tests covering plain paths, :line, :line:col, git grep output, Windows paths, URLs, timestamps, Maven coords, zero values

Testing

Build with: mvn clean verify -Pbuild-individual-bundles -pl terminal/bundles/org.eclipse.terminal.view.core,terminal/bundles/org.eclipse.terminal.view.ui,terminal/tests/org.eclipse.terminal.test -am

Closes #...

@iloveeclipse

Copy link
Copy Markdown
Member

@RoiSoleil : please sign ECA, see https://api.eclipse.org/git/eca/status/gh/eclipse-platform/eclipse.platform/2841

Without this we can't accept contributions.

@eclipse-platform-bot

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

terminal/bundles/org.eclipse.terminal.view.core/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 9841264a89a0e0109be73063feb28cd754187f60 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Thu, 30 Jul 2026 17:36:59 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/terminal/bundles/org.eclipse.terminal.view.core/META-INF/MANIFEST.MF b/terminal/bundles/org.eclipse.terminal.view.core/META-INF/MANIFEST.MF
index 0451eb54fc..1d1e10a0b8 100644
--- a/terminal/bundles/org.eclipse.terminal.view.core/META-INF/MANIFEST.MF
+++ b/terminal/bundles/org.eclipse.terminal.view.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.terminal.view.core;singleton:=true
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 1.0.200.qualifier
 Bundle-Activator: org.eclipse.terminal.view.core.internal.CoreBundleActivator
 Bundle-Vendor: %providerName
 Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.9.0,4.0.0)",
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ± 0      54 suites  ±0   53m 57s ⏱️ - 2m 6s
 4 734 tests +32   4 712 ✅ +32   22 💤 ±0  0 ❌ ±0 
12 096 runs  +96  11 943 ✅ +96  153 💤 ±0  0 ❌ ±0 

Results for commit af94c9e. ± Comparison against base commit 29df77f.

♻️ This comment has been updated with latest results.

@RoiSoleil

Copy link
Copy Markdown
Contributor Author

@RoiSoleil : please sign ECA, see https://api.eclipse.org/git/eca/status/gh/eclipse-platform/eclipse.platform/2841

Without this we can't accept contributions.

It's OK now ;)

RoiSoleil and others added 4 commits July 31, 2026 17:49
Introduce FileReference record and FileReferenceParser to handle
path:line:column references displayed in the terminal (e.g., from
'git grep -n' output).

- FileReferenceParser parses hover text into path + optional line/column
- OpenFileMouseHandler uses it instead of inline regex parsing
- Both classes in view.core.internal (x-internal, no new public API)
- 25 unit tests cover plain paths, :line, :line:col, Windows paths,
  edge cases (zero values, URLs, timestamps, Maven coordinates)
- Strip trailing colon from path when no line/col suffix matches
- Fix column offset: 1-based input -> 0-based document (col - 1)
- Rename parser patterns for clarity
- Make test classes/methods public
- Add test for plain path ending with colon
- Update time-like test: 12:30:45 parsed as path=12, line=30, col=45
- Remove <p> around <ul> list in FileReferenceParser (invalid HTML that
  failed javadoc doclint with 'unexpected end tag: </p>')
- Use HTML entity &ge; instead of raw Unicode char
- Add main descriptions to FileReference.hasLine/hasColumn
@RoiSoleil
RoiSoleil force-pushed the add-file-line-column-support branch from feffc6a to c303989 Compare July 31, 2026 15:49
FileReference and FileReferenceParser live in the x-internal package
org.eclipse.terminal.view.core.internal. Referencing them from view.ui and
the test bundle produces 'access restriction' compiler warnings (6 new
issues in CI). Add @SuppressWarnings("restriction") at class level, matching
the existing pattern used for OpenResourceDialog.
- Remove redundant @SuppressWarnings('restriction') on mouseUp, now
  covered by the class-level annotation
- Remove @SuppressWarnings('restriction') from test classes: the test
  bundle sets discouragedReference=ignore, so no access-restriction
  warnings are produced; the annotation only generated an 'unused
  compiler option' info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants